@extends('home.parent')
@section('title','第三方配置')
@section('head_js')
@endsection
@section('head_css')
@endsection
@section('content')
<div class="content-wrapper">
<section class="content-header">
	<h1>
		第三方配置
		<small></small>
	</h1>
	<ol class="breadcrumb">
		<li><a href="{{URL('admin')}}"><i class="fa fa-dashboard"></i> 首页</a></li>
		<li class="active">第三方配置</li>
	</ol>
</section>
<style>
.box-body div.header{border:1px solid #d5d5d5;margin:10px 0 0 0;border-bottom: none;color:#717171;}
.box-body div.testall{border:1px solid #d5d5d5;}
.box-body div.testall div{color:#717171;padding-top:20px;}
.box-body div.testall div label{padding: 6px 15px 0 0;text-align:right;min-width:160px;}
.box-body div.testall div input{width:50%;display:inline-block;min-width:100px;}
.box-body div.testall div button{margin-right:10px;}
	.box-body div.testall div.col-md-12{margin-left:160px;}
@media screen and (max-width: 480px) {
	.box-body div.testall div label{text-align:left;}
	.box-body div.testall div input[type="text"]{width:80%;}
	.box-body div.testall div.col-md-12{margin-left:0;}
}
</style>
<section class="content">
	<div class="row">
		<div class="col-md-12">
			<div class="box box-primary">
				<div class="box-body">
					<!-- 七牛云配置 star-->
					<div class="form-group col-md-12 header">
						<label for="text"><h4><b>七牛云配置</b></h4></label>
					</div>
					<div class="form-group col-md-12 testall qiniu">
						<form class="qiniu" action="" method="">
						<div class="form-group col-md-6">
							<label>Accesskey：</label>
							<input type="text" class="form-control" name="qnAccesskey" value="{{ isset($data['qiniu']['qnAccesskey'])?$data['qiniu']['qnAccesskey']:'' }}" autocomplete="off" placeholder="用于签名的公钥">
						</div>
						<div class="form-group col-md-6">
							<label>Secretkey：</label>
							<input type="text" class="form-control" name="qnSecretkey" value="{{ isset($data['qiniu']['qnSecretkey'])?$data['qiniu']['qnSecretkey']:'' }}" autocomplete="off" placeholder="用于签名的私钥">
						</div>
						<div class="form-group col-md-6">
							<label>Bucket：</label>
							<input type="text" class="form-control" name="qnBucket" value="{{ isset($data['qiniu']['qnBucket'])?$data['qiniu']['qnBucket']:'' }}" autocomplete="off" placeholder="请保证bucket为可公共读取的">
						</div>
						<div class="form-group col-md-6">
							<label>url：</label>
							<input type="text" class="form-control" name="qnUrl" value="{{ isset($data['qiniu']['qnUrl'])?$data['qiniu']['qnUrl']:'' }}" autocomplete="off" placeholder="七牛云调用地址。注：url开头加http://或https://结尾不加 ‘/’例：http://abc.com">
						</div>
						<div class="form-group col-md-6">
							<label>bankUrl：</label>
							<input type="text" class="form-control" name="qnBankUrl" value="{{ isset($data['qiniu']['qnBankUrl'])?$data['qiniu']['qnBankUrl']:'' }}" autocomplete="off" placeholder="七牛云回调地址。注：url开头加http://或https://结尾不加 ‘/’例：http://abc.com">
						</div>
						<div class="form-group col-md-12">
							<button type="button" class="btn btn-success" onclick="ceshi_qiniu()">测试配置</button>
							<button type="button" class="btn btn-info" onclick="dataSubmit('qiniu')">保 存</button>
							<button type="reset" class="btn btn-default">重 置</button>
						</div>
						</form>
					</div>
					<!-- 七牛云配置 end-->
					
					<!-- 阿里云ai视频配置 star-->
					<div class="form-group col-md-12 header">
						<label for="text"><h4><b>阿里云ai视频配置</b></h4></label>
					</div>
					<div class="form-group col-md-12 testall aliyun">
						<form class="aliyun" action="" method="">
						<div class="form-group col-md-6">
							<label>Accesskey：</label>
							<input type="text" class="form-control" name="alAccesskey" value="{{ isset($data['aliyun']['alAccesskey'])?$data['aliyun']['alAccesskey']:'' }}" autocomplete="off" placeholder="阿里云AccessKeyId">
						</div>
						<div class="form-group col-md-6">
							<label>AccessKeySecret：</label>
							<input type="text" class="form-control" name="alAccessKeySecret" value="{{ isset($data['aliyun']['alAccessKeySecret'])?$data['aliyun']['alAccessKeySecret']:'' }}" autocomplete="off" placeholder="阿里云AccessKeySecret">
						</div>
						<div class="form-group col-md-6">
							<label>Bucket：</label>
							<input type="text" class="form-control" name="alBucket" value="{{ isset($data['aliyun']['alBucket'])?$data['aliyun']['alBucket']:'' }}" autocomplete="off" placeholder="当前仅支持上海地域的Bucket">
						</div>
						<div class="form-group col-md-6">
							<label>url：</label>
							<input type="text" class="form-control" name="alUrl" value="{{ isset($data['aliyun']['alUrl'])?$data['aliyun']['alUrl']:'' }}" autocomplete="off" placeholder="阿里云调用地址。注：url开头加http://或https://结尾不加 ‘/’例：http://abc.com">
						</div>
						<div class="form-group col-md-6">
							<label>bankUrl：</label>
							<input type="text" class="form-control" name="alBankUrl" value="{{ isset($data['aliyun']['alBankUrl'])?$data['aliyun']['alBankUrl']:'' }}" autocomplete="off" placeholder="阿里云回调地址。注：url开头加http://或https://结尾不加 ‘/’例：http://abc.com">
						</div>
						<div class="form-group col-md-12">
							<button type="button" class="btn btn-info" onclick="dataSubmit('aliyun')">保 存</button>
							<button type="reset" class="btn btn-default">重 置</button>
						</div>
						</form>
					</div>
					<!-- 阿里云ai视频配置 end-->
					
					<!-- 支付宝支付配置 star-->
					<div class="form-group col-md-12 header">
						<label for="text"><h4><b>支付宝支付配置（您的支付宝账号必须支持手机网页即时到账接口, 才能使用手机支付功能：https://b.alipay.com/order/productDetail.htm?productId=2013080604609688. ）</b></h4></label>
					</div>
					<div class="form-group col-md-12 testall zhifb">
						<form class="zhifb" action="" method="">
						<div class="form-group col-md-6">
							<label>收款支付宝账号：</label>
							<input type="text" class="form-control" name="zfbCltName" value="{{ isset($data['zhifb']['zfbCltName'])?$data['zhifb']['zfbCltName']:'' }}" autocomplete="off" placeholder="请输入收款支付宝账号">
						</div>
						<div class="form-group col-md-6">
							<label>合作者身份：</label>
							<input type="text" class="form-control" name="zfbClbt" value="{{ isset($data['zhifb']['zfbClbt'])?$data['zhifb']['zfbClbt']:'' }}" autocomplete="off" placeholder="请输入支付宝合作者身份">
						</div>
						<div class="form-group col-md-6">
							<label>校验密钥：</label>
							<input type="text" class="form-control" name="zfbSecretKey" value="{{ isset($data['zhifb']['zfbSecretKey'])?$data['zhifb']['zfbSecretKey']:'' }}" autocomplete="off" placeholder="请输入校验密钥">
						</div>
						<div class="form-group col-md-6">
							<label>url：</label>
							<input type="text" class="form-control" name="zfbUrl" value="{{ isset($data['zhifb']['zfbUrl'])?$data['zhifb']['zfbUrl']:'' }}" autocomplete="off" placeholder="支付宝调用地址。注：url开头加http://或https://结尾不加 ‘/’例：http://abc.com">
						</div>
						<div class="form-group col-md-6">
							<label>bankUrl：</label>
							<input type="text" class="form-control" name="zfbBankUrl" value="{{ isset($data['zhifb']['zfbBankUrl'])?$data['zhifb']['zfbBankUrl']:'' }}" autocomplete="off" placeholder="支付宝回调地址。注：url开头加http://或https://结尾不加 ‘/’例：http://abc.com">
						</div>
						<div class="form-group col-md-12">
							<button type="button" class="btn btn-success" onclick="ceshi('zhifb')">测试0.1元</button>
							<button type="button" class="btn btn-info" onclick="dataSubmit('zhifb')">保 存</button>
							<button type="reset" class="btn btn-default">重 置</button>
						</div>
						</form>
					</div>
					<!-- 支付宝支付配置 end-->
					
					<!-- 微信支付配置 star-->
					<div class="form-group col-md-12 header">
						<label for="text"><h4><b>微信支付配置</b></h4></label>
					</div>
					<div class="form-group col-md-12 testall weixin">
						<form class="weixin" action="" method="">
						<div class="form-group col-md-6">
							<label>AccessKeyId：</label>
							<input type="text" class="form-control" name="wxAccessKeyId" value="{{ isset($data['weixin']['wxAccessKeyId'])?$data['weixin']['wxAccessKeyId']:'' }}" autocomplete="off" placeholder="微信AccessKeyId">
						</div>
						<div class="form-group col-md-6">
							<label>AccessKeySecret：</label>
							<input type="text" class="form-control" name="wxAccessKeySecret" value="{{ isset($data['weixin']['wxAccessKeySecret'])?$data['weixin']['wxAccessKeySecret']:'' }}" autocomplete="off" placeholder="微信AccessKeySecret">
						</div>
						<div class="form-group col-md-6">
							<label>Bucket：</label>
							<input type="text" class="form-control" name="wxBucket" value="{{ isset($data['weixin']['wxBucket'])?$data['weixin']['wxBucket']:'' }}" autocomplete="off" placeholder="当前仅支持上海地域的Bucket">
						</div>
						<div class="form-group col-md-6">
							<label>url：</label>
							<input type="text" class="form-control" name="wxUrl" value="{{ isset($data['weixin']['wxUrl'])?$data['weixin']['wxUrl']:'' }}" autocomplete="off" placeholder="微信调用地址。注：url开头加http://或https://结尾不加 ‘/’例：http://abc.com">
						</div>
						<div class="form-group col-md-6">
							<label>bankUrl：</label>
							<input type="text" class="form-control" name="wxBankUrl" value="{{ isset($data['weixin']['wxBankUrl'])?$data['weixin']['wxBankUrl']:'' }}" autocomplete="off" placeholder="微信回调地址。注：url开头加http://或https://结尾不加 ‘/’例：http://abc.com">
						</div>
						<div class="form-group col-md-12">
							<button type="button" class="btn btn-success" onclick="ceshi('weixin')">测试0.1元</button>
							<button type="button" class="btn btn-info" onclick="dataSubmit('weixin')">保 存</button>
							<button type="reset" class="btn btn-default">重 置</button>
						</div>
						</form>
					</div>
					<!-- 微信支付配置 end-->
					
					<!-- 抖音配置 star-->
					<div class="form-group col-md-12 header">
						<label for="text"><h4><b>抖音配置</b></h4></label>
					</div>
					<div class="form-group col-md-12 testall douyin">
						<form class="douyin" action="" method="">
						<div class="form-group col-md-6">
							<label>client_key：</label>
							<input type="text" class="form-control" name="dy_client_key" value="{{ isset($data['douyin']['dy_client_key'])?$data['douyin']['dy_client_key']:'' }}" autocomplete="off" placeholder="抖音client_key">
						</div>
						<div class="form-group col-md-6">
							<label>client_secret：</label>
							<input type="text" class="form-control" name="dy_client_secret" value="{{ isset($data['douyin']['dy_client_secret'])?$data['douyin']['dy_client_secret']:'' }}" autocomplete="off" placeholder="抖音client_secret">
						</div>
						<div class="form-group col-md-6">
							<label>url：</label>
							<input type="text" class="form-control" name="dy_url" value="{{ isset($data['douyin']['dy_url'])?$data['douyin']['dy_url']:'' }}" autocomplete="off" placeholder="抖音调用地址。注：url开头加http://或https://结尾不加 ‘/’例：http://abc.com">
						</div>
						<div class="form-group col-md-6">
							<label>bankUrl：</label>
							<input type="text" class="form-control" name="dy_bank_url" value="{{ isset($data['douyin']['dy_bank_url'])?$data['douyin']['dy_bank_url']:'' }}" autocomplete="off" placeholder="抖音回调地址。注：url开头加http://或https://结尾不加 ‘/’例：http://abc.com">
						</div>
						<div class="form-group col-md-12">
							<button type="button" class="btn btn-info" onclick="dataSubmit('douyin')">保 存</button>
							<button type="reset" class="btn btn-default">重 置</button>
						</div>
						</form>
					</div>
					<!-- 抖音配置 end-->
					
					<!-- 快手配置 star-->
					<div class="form-group col-md-12 header">
						<label for="text"><h4><b>快手配置</b></h4></label>
					</div>
					<div class="form-group col-md-12 testall kuaish">
						<form class="kuaish" action="" method="">
						<div class="form-group col-md-6">
							<label>client_key：</label>
							<input type="text" class="form-control" name="ks_client_key" value="{{ isset($data['kuaish']['ks_client_key'])?$data['kuaish']['ks_client_key']:'' }}" autocomplete="off" placeholder="快手client_key">
						</div>
						<div class="form-group col-md-6">
							<label>client_secret：</label>
							<input type="text" class="form-control" name="ks_client_secret" value="{{ isset($data['kuaish']['ks_client_secret'])?$data['kuaish']['ks_client_secret']:'' }}" autocomplete="off" placeholder="快手client_secret">
						</div>
						<div class="form-group col-md-6">
							<label>url：</label>
							<input type="text" class="form-control" name="ks_url" value="{{ isset($data['kuaish']['ks_url'])?$data['kuaish']['ks_url']:'' }}" autocomplete="off" placeholder="快手调用地址。注：url开头加http://或https://结尾不加 ‘/’例：http://abc.com">
						</div>
						<div class="form-group col-md-6">
							<label>bankUrl：</label>
							<input type="text" class="form-control" name="ks_bank_url" value="{{ isset($data['kuaish']['ks_bank_url'])?$data['kuaish']['ks_bank_url']:'' }}" autocomplete="off" placeholder="快手回调地址。注：url开头加http://或https://结尾不加 ‘/’例：http://abc.com">
						</div>
						<div class="form-group col-md-12">
							<button type="button" class="btn btn-info" onclick="dataSubmit('kuaish')">保 存</button>
							<button type="reset" class="btn btn-default">重 置</button>
						</div>
						</form>
					</div>
					<!-- 快手配置 end-->
					
					<!-- 微信视频号配置 star-->
					<div class="form-group col-md-12 header">
						<label for="text"><h4><b>微信视频号配置</b></h4></label>
					</div>
					<div class="form-group col-md-12 testall weishi">
						<form class="weishi" action="" method="">
						<div class="form-group col-md-6">
							<label>client_key：</label>
							<input type="text" class="form-control" name="ws_client_key" value="{{ isset($data['weishi']['ws_client_key'])?$data['weishi']['ws_client_key']:'' }}" autocomplete="off" placeholder="微信视频号client_key">
						</div>
						<div class="form-group col-md-6">
							<label>client_secret：</label>
							<input type="text" class="form-control" name="ws_client_secret" value="{{ isset($data['weishi']['ws_client_secret'])?$data['weishi']['ws_client_secret']:'' }}" autocomplete="off" placeholder="微信视频号client_secret">
						</div>
						<div class="form-group col-md-6">
							<label>url：</label>
							<input type="text" class="form-control" name="ws_url" value="{{ isset($data['weishi']['ws_url'])?$data['weishi']['ws_url']:'' }}" autocomplete="off" placeholder="微视调用地址。注：url开头加http://或https://结尾不加 ‘/’例：http://abc.com">
						</div>
						<div class="form-group col-md-6">
							<label>bankUrl：</label>
							<input type="text" class="form-control" name="ws_bank_url" value="{{ isset($data['weishi']['ws_bank_url'])?$data['weishi']['ws_bank_url']:'' }}" autocomplete="off" placeholder="微视回调地址。注：url开头加http://或https://结尾不加 ‘/’例：http://abc.com">
						</div>
						<div class="form-group col-md-12">
							<button type="button" class="btn btn-info" onclick="dataSubmit('weishi')">保 存</button>
							<button type="reset" class="btn btn-default">重 置</button>
						</div>
						</form>
					</div>
					<!-- 微信视频号配置 end-->
				</div>
			</div>
		</div>
	</div>
</section>
</div>
<style>
.qiniuUploadForm img{width:100px;height:100px;cursor:pointer;}
.qiniuUploadForm input[type="file"]{display:none;}
.qiniuUploadForm span#uploadVideo{
	display:block;height:100px;width:150px;text-align:center;border:1px solid #717171;border-radius:10px;cursor:pointer;
	word-wrap: break-word;word-break: break-all;white-space: pre-wrap !important;padding:10px;
}
</style>
<!-- 七牛测试 -->
<div class="modal fade" id="modal-info">
	<div class="modal-dialog">
		<div class="modal-content  col-md-12">
			<div class="modal-header">
				<button type="button" class="close" data-dismiss="modal" aria-label="Close">
				<span aria-hidden="true">&times;</span></button>
				<h4 class="modal-title">七牛测试</h4>
			</div>
			<div class="modal-body">
			<form class="qiniuUploadForm" method="post" enctype="multipart/form-data">
				<div class="form-group col-md-6">
					<img src="/images/upimg.png" id="uploadImg">
					<span><input type="file" name="optImg" id="optImg" onchange="optImgChange(this)"></span>
				</div>
				<div class="form-group col-md-6">
					<span id="uploadVideo">点击选择视频</span>
					<span><input type="file" name="optVideo" id="optVideo" onchange="optVideoChange(this)"></span>
				</div>
			</form>
			</div>
			<div class="modal-body col-md-12 look">
			</div>
			<div class="modal-footer col-md-12">
				<button type="button" class="btn btn-default pull-left" data-dismiss="modal">关闭</button>
				<button type="button" class="btn btn-primary" onclick="qiniuUpload(this)">上传</button>
			</div>
		</div>
		<!-- /.modal-content -->
	</div>
	<!-- /.modal-dialog -->
</div>
@endsection
@section('foot_js')
<script src="{{ asset('/js/tools.js') }}"></script>
<script type="text/javascript">
/*
保存操作
*/
function dataSubmit(typeName){
	var data='';
	if(typeName=='qiniu'){
		var data=$('form.qiniu').serialize();
	}else if(typeName=='aliyun'){
		var data=$('form.aliyun').serialize();
	}else if(typeName=="zhifb"){
		var data=$('form.zhifb').serialize();
	}else if(typeName=="weixin"){
		var data=$('form.weixin').serialize();
	}else if(typeName=="douyin"){
		var data=$('form.douyin').serialize();
	}else if(typeName=="kuaish"){
		var data=$('form.kuaish').serialize();
	}else if(typeName=="weishi"){
		var data=$('form.weishi').serialize();
	}
	data+="&typeName="+typeName;
	var url = "{{URL('admin/config/third/save')}}";
	var result = puppet.myajax('post',url,data,false);
	if(result.code == 1){
		layer.msg(result.msg,{icon:2});
		return false;
	}else{
		layer.msg(result.msg,{icon:1});
		setTimeout('window.location.reload()',1000);
	}
}
//七牛云测试
function ceshi_qiniu(){
	$('#modal-info').modal();
}
//触发图片上传控件
$('#uploadImg').click(function(){
	$('#optImg').val('').click();
	$('#uploadImg').attr('src','/images/upimg.png');
	$('.look a.img').remove();
});
//上传控件值发生改变替换图片
function optImgChange(obj){
	var imgSrc=puppet.getObjectURL(obj);
	// console.log(getObjectURL(this.files[0]));
	$('#uploadImg').attr('src',imgSrc);
}
//触发视频上传控件
$('#uploadVideo').click(function(){
	$('#optVideo').val('').click();
	$('#uploadVideo').html('点击选择视频');
	$('.look a.video').remove();
});
//上传控件值发生改变替换文件名
function optVideoChange(obj){
	var videoName=obj.files[0]['name'];
	$('#uploadVideo').html(videoName);
}
//上传到七牛云方法
function qiniuUpload(obj){
	$(obj).prop('disabled',true).html('上传中');
	var data=new FormData();
	data.append("fileImg",$('#optImg')[0].files[0]);
	data.append("fileVideo",$('#optVideo')[0].files[0]);
	$('.qiniuUploadForm').serialize();
	// console.log(data);
	$.ajax({
		url: "{{URL('upload/commit/qiniu')}}",
		data: data,
		type: "Post",
		dataType: "json",
		cache: false,//上传文件无需缓存
		processData: false,//用于对data参数进行序列化处理 这里必须false
		contentType: false, //必须
		success: function (result) {
			if(result.code == 1){
				layer.msg(result.msg,{icon:1});
			}else{
				layer.msg(result.msg,{icon:1});
				var html="<a class='img' href='"+result.data.imgUrl+"' target='_blank'>查看图片</a>&nbsp;&nbsp;&nbsp;&nbsp;<a class='video' href='"+result.data.videoUrl+"' target='_blank'>查看视频</a>";
				$('.look').html(html);
			}
			$(obj).prop('disabled',false).html('上传');
		},error :function (XMLHttpRequest, textStatus, errorThrown){
			$(obj).prop('disabled',false).html('上传');
			layer.msg("网络错误",{icon:2});
		},
	});
}
/*
测试操作
*/
function ceshi(typeName){
	
}
</script>
@endsection